<template>
	<view>
		<!-- 用户注册申请 -->
		<view>
			<uni-section title="用户注册申请" type="line" padding>
				<!-- 基本信息 -->
				<uni-list>
					<uni-list-item title="用户编号" :rightText="user.uid" />
					<uni-list-item title="用户类型" :rightText="userType[user.ulevel-1]" />
					<uni-list-item title="用户名" :rightText="user.uname" />
					<uni-list-item title="职称" :rightText="user.ujob" />
					<uni-list-item title="联系方式" :rightText="user.uphone" />
					<uni-list-item title="密码" :rightText="user.upassword" />
				</uni-list>
				<!-- 驳回原因 -->
				<uni-forms-item label="驳回原因">
					<uni-easyinput type="textarea" v-model="reason" placeholder="请输入驳回申请的原因(接受请求可不填)" />
				</uni-forms-item>
				<!-- 按钮 -->
				<view class="button">
					<button type="primary" plain="true" @click="allow">通过申请</button>
					<button type="primary" plain="true" @click="refuse">驳回申请</button>
				</view>
			</uni-section>
		</view>
		
		<!-- 用户信息修改申请 -->
		<view v-if="false">
			<uni-section title="用户信息修改申请" type="line" padding>
				<uni-list>
					<uni-list-item title="用户编号" :rightText="user.uid" />
					<uni-list-item v-if="user.new.ulevel != user.old.ulevel" title="用户类型" :rightText="userType[user.old.ulevel-1] + ' -> ' + userType[user.new.ulevel-1]" />
					<uni-list-item v-if="user.new.uname != ''" title="用户名" :rightText="user.old.uname + ' -> ' + user.new.uname" />
					<uni-list-item v-if="user.new.ujob != ''" title="职称" :rightText="user.old.ujob + ' -> ' + user.new.ujob" />
					<uni-list-item v-if="user.new.uphone != ''" title="联系方式" :rightText="user.old.uphone + ' -> ' + user.new.uphone" />
					<uni-list-item v-if="user.new.upassword != ''" title="密码" :rightText="user.old.upassword + ' -> ' + user.new.upassword" />
				</uni-list>
				<!-- 驳回原因 -->
				<uni-forms-item label="驳回原因">
					<uni-easyinput type="textarea" v-model="reason" placeholder="请输入驳回申请的原因(接受请求可不填)" />
				</uni-forms-item>
				<!-- 按钮 -->
				<view class="button">
					<button type="primary" plain="true" @click="allow">通过申请</button>
					<button type="primary" plain="true" @click="refuse">驳回申请</button>
				</view>
			</uni-section>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				user: {
					
				},
				reason: '',
				userType: ['管理员', '维修人员', '普通用户']
			}
		},
		onLoad(options) {
			let data = JSON.parse(options.user);
			this.user = data
		},
		methods: {
			allow() {
				uni.navigateBack({
					delta: 1
				});
			},
			refuse() {
				uni.navigateBack({
					delta: 1
				});
			}
		}
	}
</script>

<style>
	.uni-padding-wrap {
		width: 710rpx;
		padding: 0px 0px;
	}
	.uni-common-mt {
		margin-top: 0px;
	}
	.button{
		display: flex;
		flex-direction: row;
		margin-top: 30rpx;
	}
</style>